#include "stdafx.h"

// Inheritance is: IUnknown<-ICorProfilerCallback<-ICorProfilerCallback2<-ICorProfilerCallback3
class ProfilerCallback : public ICorProfilerCallback3
{
public:
	ProfilerCallback();
public:
	//
	// IUnknown
	//
	ULONG STDMETHODCALLTYPE AddRef(); 
	ULONG STDMETHODCALLTYPE Release();
	HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void **ppInterface );
public:
	//
	// ICorProfilerCallback
	//
	virtual HRESULT STDMETHODCALLTYPE Initialize( 
		/* [in] */ IUnknown *pICorProfilerInfoUnk);

	virtual HRESULT STDMETHODCALLTYPE Shutdown( void);

	virtual HRESULT STDMETHODCALLTYPE AppDomainCreationStarted( 
		/* [in] */ AppDomainID appDomainId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE AppDomainCreationFinished( 
		/* [in] */ AppDomainID appDomainId,
		/* [in] */ HRESULT hrStatus) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE AppDomainShutdownStarted( 
		/* [in] */ AppDomainID appDomainId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE AppDomainShutdownFinished( 
		/* [in] */ AppDomainID appDomainId,
		/* [in] */ HRESULT hrStatus) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE AssemblyLoadStarted( 
		/* [in] */ AssemblyID assemblyId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE AssemblyLoadFinished( 
		/* [in] */ AssemblyID assemblyId,
		/* [in] */ HRESULT hrStatus) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE AssemblyUnloadStarted( 
		/* [in] */ AssemblyID assemblyId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE AssemblyUnloadFinished( 
		/* [in] */ AssemblyID assemblyId,
		/* [in] */ HRESULT hrStatus) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ModuleLoadStarted( 
		/* [in] */ ModuleID moduleId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ModuleLoadFinished( 
		/* [in] */ ModuleID moduleId,
		/* [in] */ HRESULT hrStatus) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ModuleUnloadStarted( 
		/* [in] */ ModuleID moduleId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ModuleUnloadFinished( 
		/* [in] */ ModuleID moduleId,
		/* [in] */ HRESULT hrStatus) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ModuleAttachedToAssembly( 
		/* [in] */ ModuleID moduleId,
		/* [in] */ AssemblyID AssemblyId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ClassLoadStarted( 
		/* [in] */ ClassID classId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ClassLoadFinished( 
		/* [in] */ ClassID classId,
		/* [in] */ HRESULT hrStatus) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ClassUnloadStarted( 
		/* [in] */ ClassID classId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ClassUnloadFinished( 
		/* [in] */ ClassID classId,
		/* [in] */ HRESULT hrStatus) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE FunctionUnloadStarted( 
		/* [in] */ FunctionID functionId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE JITCompilationStarted( 
		/* [in] */ FunctionID functionId,
		/* [in] */ BOOL fIsSafeToBlock) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE JITCompilationFinished( 
		/* [in] */ FunctionID functionId,
		/* [in] */ HRESULT hrStatus,
		/* [in] */ BOOL fIsSafeToBlock) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE JITCachedFunctionSearchStarted( 
		/* [in] */ FunctionID functionId,
		/* [out] */ BOOL *pbUseCachedFunction) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE JITCachedFunctionSearchFinished( 
		/* [in] */ FunctionID functionId,
		/* [in] */ COR_PRF_JIT_CACHE result) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE JITFunctionPitched( 
		/* [in] */ FunctionID functionId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE JITInlining( 
		/* [in] */ FunctionID callerId,
		/* [in] */ FunctionID calleeId,
		/* [out] */ BOOL *pfShouldInline) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ThreadCreated( 
		/* [in] */ ThreadID threadId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ThreadDestroyed( 
		/* [in] */ ThreadID threadId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ThreadAssignedToOSThread( 
		/* [in] */ ThreadID managedThreadId,
		/* [in] */ DWORD osThreadId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RemotingClientInvocationStarted( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RemotingClientSendingMessage( 
		/* [in] */ GUID *pCookie,
		/* [in] */ BOOL fIsAsync) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RemotingClientReceivingReply( 
		/* [in] */ GUID *pCookie,
		/* [in] */ BOOL fIsAsync) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RemotingClientInvocationFinished( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RemotingServerReceivingMessage( 
		/* [in] */ GUID *pCookie,
		/* [in] */ BOOL fIsAsync) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RemotingServerInvocationStarted( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RemotingServerInvocationReturned( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RemotingServerSendingReply( 
		/* [in] */ GUID *pCookie,
		/* [in] */ BOOL fIsAsync) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE UnmanagedToManagedTransition( 
		/* [in] */ FunctionID functionId,
		/* [in] */ COR_PRF_TRANSITION_REASON reason) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ManagedToUnmanagedTransition( 
		/* [in] */ FunctionID functionId,
		/* [in] */ COR_PRF_TRANSITION_REASON reason) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RuntimeSuspendStarted( 
		/* [in] */ COR_PRF_SUSPEND_REASON suspendReason) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RuntimeSuspendFinished( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RuntimeSuspendAborted( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RuntimeResumeStarted( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RuntimeResumeFinished( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RuntimeThreadSuspended( 
		/* [in] */ ThreadID threadId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RuntimeThreadResumed( 
		/* [in] */ ThreadID threadId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE MovedReferences( 
		/* [in] */ ULONG cMovedObjectIDRanges,
		/* [size_is][in] */ ObjectID oldObjectIDRangeStart[  ],
		/* [size_is][in] */ ObjectID newObjectIDRangeStart[  ],
		/* [size_is][in] */ ULONG cObjectIDRangeLength[  ]) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ObjectAllocated( 
		/* [in] */ ObjectID objectId,
		/* [in] */ ClassID classId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ObjectsAllocatedByClass( 
		/* [in] */ ULONG cClassCount,
		/* [size_is][in] */ ClassID classIds[  ],
		/* [size_is][in] */ ULONG cObjects[  ]) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ObjectReferences( 
		/* [in] */ ObjectID objectId,
		/* [in] */ ClassID classId,
		/* [in] */ ULONG cObjectRefs,
		/* [size_is][in] */ ObjectID objectRefIds[  ]) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RootReferences( 
		/* [in] */ ULONG cRootRefs,
		/* [size_is][in] */ ObjectID rootRefIds[  ]) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionThrown( 
		/* [in] */ ObjectID thrownObjectId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionSearchFunctionEnter( 
		/* [in] */ FunctionID functionId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionSearchFunctionLeave( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionSearchFilterEnter( 
		/* [in] */ FunctionID functionId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionSearchFilterLeave( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionSearchCatcherFound( 
		/* [in] */ FunctionID functionId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionOSHandlerEnter( 
		/* [in] */ UINT_PTR __unused) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionOSHandlerLeave( 
		/* [in] */ UINT_PTR __unused) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionUnwindFunctionEnter( 
		/* [in] */ FunctionID functionId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionUnwindFunctionLeave( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionUnwindFinallyEnter( 
		/* [in] */ FunctionID functionId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionUnwindFinallyLeave( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionCatcherEnter( 
		/* [in] */ FunctionID functionId,
		/* [in] */ ObjectID objectId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionCatcherLeave( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE COMClassicVTableCreated( 
		/* [in] */ ClassID wrappedClassId,
		/* [in] */ REFGUID implementedIID,
		/* [in] */ void *pVTable,
		/* [in] */ ULONG cSlots) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE COMClassicVTableDestroyed( 
		/* [in] */ ClassID wrappedClassId,
		/* [in] */ REFGUID implementedIID,
		/* [in] */ void *pVTable) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionCLRCatcherFound( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ExceptionCLRCatcherExecute( void) { return E_FAIL; }
public:
	//
	// ICorProfilerCallback2
	//
	virtual HRESULT STDMETHODCALLTYPE ThreadNameChanged( 
		/* [in] */ ThreadID threadId,
		/* [in] */ ULONG cchName,
		/* [annotation][in] */ 
		_In_reads_opt_(cchName)  WCHAR name[  ]) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE GarbageCollectionStarted( 
		/* [in] */ int cGenerations,
		/* [size_is][in] */ BOOL generationCollected[  ],
		/* [in] */ COR_PRF_GC_REASON reason) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE SurvivingReferences( 
		/* [in] */ ULONG cSurvivingObjectIDRanges,
		/* [size_is][in] */ ObjectID objectIDRangeStart[  ],
		/* [size_is][in] */ ULONG cObjectIDRangeLength[  ]) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE GarbageCollectionFinished( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE FinalizeableObjectQueued( 
		/* [in] */ DWORD finalizerFlags,
		/* [in] */ ObjectID objectID) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE RootReferences2( 
		/* [in] */ ULONG cRootRefs,
		/* [size_is][in] */ ObjectID rootRefIds[  ],
		/* [size_is][in] */ COR_PRF_GC_ROOT_KIND rootKinds[  ],
		/* [size_is][in] */ COR_PRF_GC_ROOT_FLAGS rootFlags[  ],
		/* [size_is][in] */ UINT_PTR rootIds[  ]) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE HandleCreated( 
		/* [in] */ GCHandleID handleId,
		/* [in] */ ObjectID initialObjectId) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE HandleDestroyed( 
		/* [in] */ GCHandleID handleId) { return E_FAIL; }
public:
	//
	// ICorProfilerCallback3
	//
	virtual HRESULT STDMETHODCALLTYPE InitializeForAttach( 
		/* [in] */ IUnknown *pCorProfilerInfoUnk,
		/* [in] */ void *pvClientData,
		/* [in] */ UINT cbClientData) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ProfilerAttachComplete( void) { return E_FAIL; }

	virtual HRESULT STDMETHODCALLTYPE ProfilerDetachSucceeded( void) { return E_FAIL; }
public:
	//
	// Factory
	//
	static HRESULT STDMETHODCALLTYPE CreateObject( REFIID riid, void **ppInterface );   
public:
	//
	// Enter/Leave Callbacks
	//
	static void  Enter( FunctionID functionID );
	static void  Leave( FunctionID functionID );
	static void  Tailcall( FunctionID functionID );
private:
	//
	// Counters
	//
	long m_refCount; 
	//
	// Pointers
	//
	DWORD m_dwEventMask;
	ICorProfilerInfo *m_pProfilerInfo;  
	ICorProfilerInfo2 *m_pProfilerInfo2;
	ICorProfilerInfo3 *m_pProfilerInfo3;
};